#include <iostream>
#include <thread>

using std::cout;
using std::endl;
using std::thread;

void threadFunc()
{
    cout << "thread id = " 
         << std::this_thread::get_id() << endl;
}

//线程的执行是随机的
int main(int argc, char *argv[])
{
    cout << "main thread id = " 
         << std::this_thread::get_id() << endl;

    thread thA(threadFunc);
    thread thB(threadFunc);
    cout << "A thread id = " << thA.get_id() << endl;
    cout << "B thread id = " << thB.get_id() << endl;

    thA.join();
    thB.join();

    return 0;
}

